package com.liangdev.common.util;

import java.util.HashSet;
import java.util.Set;

public class SetUtil {

    /**
     * 把字符串放到集合中
     * 
     * @param strings
     * @return
     */
    public static Set<String> string2Set(String[] strings) {
        if (strings == null || strings.length == 0) {
            return null;
        }
        Set<String> set = new HashSet<String>();
        for (String str : strings) {
            set.add(str);
        }
        return set;
    }

    /**
     * 把字符串放到集合中，并且全部转换为大写
     * 
     * @param strings
     * @return
     */
    public static Set<String> string2SetUpperCase(String[] strings) {
        if (strings == null || strings.length == 0) {
            return null;
        }
        Set<String> set = new HashSet<String>();
        for (String str : strings) {
            set.add(str.toUpperCase());
        }
        return set;
    }
}
